import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int n = sc.nextInt();
            sc.nextLine();
            String s = sc.nextLine();
            String result = minBinaryAfterFlip(s, n);
            System.out.println(result);
        }
    }

    public static String minBinaryAfterFlip(String s, int n) {
        String minStr = s;
        char[] chars = s.toCharArray();

        for(int i=0;i<n;i++) {
            for(int j=i;j<n;j++) {
                String flipped = reverse(chars, i, j);
                if(flipped.compareTo(minStr) < 0) {
                    minStr = flipped;
                }
            }
        }

        return minStr;
    }

    public static String reverse(char[] chars, int left, int right) {
        char[] newChars = chars.clone();
        while(left < right) {
            char temp = newChars[left];
            newChars[left] = newChars[right];
            newChars[right] = temp;
            left++;
            right--;
        }
        return new String(newChars);
    }
}